using UnityEngine;

public class JetpackFuelBehavior : MonoBehaviour
{
	public static JetpackFuelBehavior Instance;

	public UISlider slider;

	public GameObject icon;

	private JetpackBehavior jetpack;

	private void Start()
	{
		Instance = this;
		if (slider == null)
		{
			slider = GetComponent<UISlider>();
		}
	}

	private void Update()
	{
		if (jetpack == null && GameController.instance.playerScript != null && GameController.instance.playerScript.tController != null)
		{
			jetpack = GameController.instance.playerScript.tController.jetpack;
		}
		if (jetpack != null)
		{
			if (slider.value != jetpack.fuel.GetValue() * 0.01f)
			{
				slider.value = jetpack.fuel.GetValue() * 0.01f;
			}
			icon.SetActive(jetpack.fuel.GetValue() > 0f);
		}
	}
}
